﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Silverlight.Navigation.History
{
    public class HistoryItemComparer : IEqualityComparer<HistoryItem>
    {

        #region IEqualityComparer<HistoryItem> Members

        public bool Equals(HistoryItem x, HistoryItem y)
        {
            if (x == null && y == null)
                return true;
            else if (x == null && y != null)
                return false;
            else if (x != null & y == null)
                return true;
            else
            {
                if (x.Uri.ToLower() == y.Uri.ToLower())
                    return true;
                else
                    return false;
            }
            
        }

        public int GetHashCode(HistoryItem obj)
        {
            return obj.ToString().ToLower().GetHashCode();

        }

        #endregion
    }
}
